package com.lz;

import java.util.*;
import java.util.stream.*;


public class demo {


    public static List<Actor> demo() {
        List<String> manStrings = Arrays.asList(
                "蔡坤坤,24", "叶齁咸,23", "刘不甜,22", "吴签,24", "谷嘉,30", "肖梁梁,27"

        );
        List<String> womanStrings = Arrays.asList(
                "赵小颖,35", "杨颖,36", "高元元,43", "张天天,31",
                "刘诗,35", "杨小幂,33"
        );
        Stream<String> limit = manStrings.
                stream().
                filter(s -> {
                    String[] split = s.split(",");
                    return split[0].length() == 3;
                }).
                limit(2);


        Stream<String> woman = womanStrings.
                stream().
                filter(s -> s.startsWith("杨")).
                skip(1);

        List<Actor> collect = Stream.concat(limit, woman).map(s -> {
            String[] split = s.split(",");
            return new Actor(split[0], Integer.parseInt(split[1]));
        }).collect(Collectors.toList());
        return collect;

    }

    public static void main(String[] args) {
        for (Object o : demo()) {
            System.out.println(o);
        }
    }


}
